import request from '@/utils/request';
import { stringify } from 'qs';
import func from '@/utils/func';

//主列表
export async function queryExpressList(params) {
  return request(`/blade-logistics/userexpress/list?${stringify(params)}`);
}

// 获取寄件地址列表
export async function queryAddressListOp(params) {
  return request(`/blade-user/useraddress/list?${stringify(params)}`);
}

// 基础快递列表
export async function getBaseExpressListOp() {
  return request(`/blade-logistics/express/listBase`);
}

//新增快递公司
export async function addExpressCompany(params) {
  return request(`/blade-logistics/userexpress/addExpress`, {
    method: 'post',
    data: params
  });
}

//删除快递配置
export async function removeExpress(params) {
  return request(`/blade-logistics/userexpress/delExpress`, {
    method: 'post',
    body: func.toFormData(params)
  });
}

//新增网点
export async function addNetwork(params) {
  return request(`/blade-logistics/userexpress/addNetwork`, {
    method: 'post',
    data: params
  });
}

//修改网点名称
export async function updateNetworkName(params) {
  return request(`/blade-logistics/userexpress/updateNetwork`, {
    method: 'post',
    data: params
  });
}

//网点绑定更换地址
export async function updateRelativeAddress(params) {
  return request(`/blade-logistics/userexpress/bindingAddress`, {
    method: 'post',
    body: func.toFormData(params)
  });
}


//面单平台列表
export async function getNetFaceList(params) {
  return request(`/blade-logistics/userstorefacebill/networkBindList?${stringify(params)}`);
}

//新增面单平台
export async function addNetworkFace(params) {
  return request(`/blade-logistics/usernetworkfacebill/updateBatch`, {
    method: 'post',
    data: params
  });
}

//删除面单平台
export async function removeNetworkFace(params) {
  return request(`/blade-logistics/networkfacebill/remove`, {
    method: 'post',
    body: func.toFormData(params)
  });
}

//设置快递网点是否启用
export async function updateMatchStatus(params) {
  return request(`/blade-logistics/userexpress/updateStatus`, {
    method: 'post',
    body: func.toFormData(params)
  });
}

//仓库列表(普通)
export async function getWareHouseList(params) {
  return request(`/zjf-wms/warehouse/networkCanUseWarehouseList?${stringify(params)}`);
}

//仓库列表(京东)
export async function getJDWareHouseList(params) {
  return request(`/zjf-wms/warehouse/jdNetworkCanUseWarehouseList?${stringify(params)}`);
}

//新增关联仓库
export async function addWareHouse(params) {
  return request(`/blade-logistics/userwarehousenetwork/bind`, {
    method: 'post',
    data: params
  });
}

//删除关联仓库
export async function removeWareHouse(params) {
  return request(`/blade-logistics/userwarehousenetwork/unBind`, {
    method: 'post',
    body: func.toFormData(params)
  });
}


//查看网点选中区域
export async function seeSelectedAreas(params) {
  return request(`/blade-logistics/networkset/selectedAreas`, {
    method: 'post',
    body: func.toFormData(params)
  });
}

//修改匹配规则
export async function updateMatchRule(params) {
  return request(`/blade-logistics/networkset/update`, {
    method: 'post',
    data: params
  });
}

//新增匹配规则
export async function saveMatchRule(params) {
  return request(`/blade-logistics/networkset/save`, {
    method: 'post',
    data: params
  });
}

//获取网点匹配用户网点下拉列表
export async function getNetworkListForMatch(params) {
  return request(`/blade-logistics/postdiscount/networkList?${stringify(params)}`);
}

//指定网点可用区域列表
export async function getAvailableList(params) {
  return request(`/blade-logistics/networkset/networkCanUse?${stringify(params)}`);
}

//快递公司可用区域列表
export async function getExpressAvailableList(params) {
  return request(`/blade-logistics/networkset/expressCanUse?${stringify(params)}`);
}

//获取网点匹配快递下拉列表
export async function getMatchExpressList(params) {
  return request(`/blade-logistics/postdiscount/expressList?${stringify(params)}`);
}

//根据网点id查询运费详情
export async function getFreightDetail(params) {
  return request(`/blade-logistics/post/detail?${stringify(params)}`);
}

//新增运费设置
export async function saveFreight(params) {
  return request(`/blade-logistics/post/save`, {
    method: 'post',
    data: params,
  });
}

//修改运费设置
export async function updateFreight(params) {
  return request(`/blade-logistics/post/update`, {
    method: 'post',
    data: params,
  });
}

//查看可选区域
export async function getCanSelectArea(params) {
  return request(`/blade-logistics/area/notIn`, {
    body: func.toFormData(params),
    method: 'post'
  });
}


//删除网点
export async function removeNetwork(params) {
  return request(`/blade-logistics/userexpress/delNetwork`, {
    method: 'post',
    body: func.toFormData(params)
  });
}




//快递公司下拉列表
export async function queryExpressCompanyList() {
  return request(`/blade-logistics/express/userExpress`);
}

//仓库下拉列表
export async function queryWareHouseList() {
  return request(`/zjf-wms/warehouse/list`);
}

// 快递种类识别 0：普通，1：京东，2：顺丰
export async function getExpressDiscern(params) {
  return request(`/blade-logistics/express/expressDiscern?${stringify(params)}`);
}

//三方区域启用/禁用
export async function threeAreaStatus(params) {
    return request(`/blade-logistics/network/threeAreaStatus`, {
      method: 'post',
      body: func.toFormData(params)
    });
  }

  //设置分拣道口
export async function setOutNum(params) {
    return request(`/blade-logistics/network/setOutNum`, {
      method: 'post',
      body: func.toFormData(params)
    });
  }

// 快递公司下拉列表 1：后台：找家纺内部，2：后台：用户快递，3：后台：优惠，5：前台：用户快递
export async function queryExpresslist(params) {
    return request(`/blade-logistics/postcopy/expresslist?${stringify(params)}`);
  }
  
// 网点/活动下拉列表 1：后台：找家纺内部，2：后台：用户快递，3：后台：优惠，5：前台：用户快递
export async function queryNetworklist(params) {
    return request(`/blade-logistics/postcopy/networklist?${stringify(params)}`);
  }

// //找家纺内部快递列表
// export async function queryExpressList(params) {
//   return request(`/blade-logistics/userexpress/list?${stringify(params)}`);
// }

// //删除快递模板
// export async function removeExpress(params) {
//   return request(`/blade-logistics/expresstemplate/remove`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }



// //修改网点名称
// export async function updateNetworkName(params) {
//   return request(`/blade-logistics/network/update`, {
//     method: 'post',
//     data: params
//   });
// }

// //删除网点
// export async function removeNetwork(params) {
//   return request(`/blade-logistics/network/remove`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //新增网点
// export async function saveNetwork(params) {
//   return request(`/blade-logistics/network/save`, {
//     method: 'post',
//     data: params
//   });
// }


// //设置网点是否启用
// export async function updateStatus(params) {
//   return request(`/blade-logistics/network/updateStatus`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //删除面单平台
// export async function removeNetworkFace(params) {
//   return request(`/blade-logistics/networkfacebill/remove`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //新增面单平台
// export async function saveNetworkFace(params) {
//   return request(`/blade-logistics/networkfacebill/save`, {
//     method: 'post',
//     data: params
//   });
// }

// //面单平台列表
// export async function getNetFaceList(params) {
//   return request(`/blade-logistics/storefacebill/selectKv?${stringify(params)}`);
// }

// //---------------------以下是用户快递接口---------------------------------------

// //获取用户快递列表分页
// export async function getUserExpressList(params) {
//   return request(`/blade-logistics/openexpress/page?${stringify(params)}`);
// }

// //获取用户快递下拉列表
// export async function getExpressListForUser(params) {
//   return request(`/blade-logistics/openexpress/expressList?${stringify(params)}`);
// }

// //删除用户快递
// export async function delExpressTemplate(params) {
//   return request(`/blade-logistics/openexpress/delExpressTemplate`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //删除用户开放网点
// export async function delNetwork(params) {
//   return request(`/blade-logistics/openexpress/delNetwork`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //获取用户网点下拉列表
// export async function getNetworkList(params) {
//   return request(`/blade-logistics/openexpress/networkList?${stringify(params)}`);
// }

// //新增用户快递
// export async function saveUserExpress(params) {
//   return request(`/blade-logistics/openexpress/saveExpress`, {
//     method: 'post',
//     data: params
//   });
// }

// //新增网点
// export async function saveUserNetwork(params) {
//   return request(`/blade-logistics/openexpress/saveNetwork`, {
//     method: 'post',
//     data: params
//   });
// }

// //设置模板类型
// export async function setTempty(params) {
//   return request(`/blade-logistics/network/setTemp`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //设置用户快递网点是否启用
// export async function updateStatusForUser(params) {
//   return request(`/blade-logistics/openexpress/updateStatus`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }


// //------------------------------以下是网点匹配设置接口----------------------------------------------


// //获取网点匹配快递列表分页
// export async function getNetworkMatchList(params) {
//   return request(`/blade-logistics/networkset/page?${stringify(params)}`);
// }

// //获取网点匹配快递下拉列表
// export async function getMatchExpressList(params) {
//   return request(`/blade-logistics/postdiscount/expressList?${stringify(params)}`);
// }

// //快递匹配规则禁用、启用
// export async function updateMatchStatus(params) {
//   return request(`/blade-logistics/networkset/updateStatus`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //网点匹配删除网点
// export async function removeMatchNetwork(params) {
//   return request(`/blade-logistics/networkset/del`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //查看网点选中区域
// export async function seeSelectedAreas(params) {
//   return request(`/blade-logistics/networkset/selectedAreas`, {
//     method: 'post',
//     body: func.toFormData(params)
//   });
// }

// //修改匹配规则
// export async function updateMatchRule(params) {
//   return request(`/blade-logistics/networkset/update`, {
//     method: 'post',
//     data: params
//   });
// }

// //新增匹配规则
// export async function saveMatchRule(params) {
//   return request(`/blade-logistics/networkset/save`, {
//     method: 'post',
//     data: params
//   });
// }

// //获取网点匹配用户网点下拉列表
// export async function getNetworkListForMatch(params) {
//   return request(`/blade-logistics/postdiscount/networkList?${stringify(params)}`);
// }

// //指定网点可用区域列表
// export async function getAvailableList(params) {
//   return request(`/blade-logistics/networkset/networkCanUse?${stringify(params)}`);
// }

// //快递公司可用区域列表
// export async function getExpressAvailableList(params) {
//   return request(`/blade-logistics/networkset/expressCanUse?${stringify(params)}`);
// }











